﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site2.Master" AutoEventWireup="true" CodeBehind="FrmProducto.aspx.cs" Inherits="Intelsi.WB.FrmProducto" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<script type="text/javascript">
    function valida() {
        var v = $('#<%=txtDescripcionProdu.ClientID%>').val();
        if (v == null) {
            alert("asunto vacio");
        }
    }
</script>

<script type="text/javascript">
    function ValidNum(e) {
        var tecla = document.all ? tecla = e.keyCode : tecla = e.which;
        return ((tecla > 47 && tecla < 58) || tecla == 46 || tecla == 8 );
    }
</script>

<script type="text/javascript">
    $(document).ready(function () {
        $('#<%= TxtFechaVencimiento.ClientID %>').datepicker()
    });
    
</script>

<script type="text/javascript">
    $(function () {
        $("#<%= TxtProvedor.ClientID %>").autocomplete({
            source: "/Service/ProveedorService.asmx/GetFromProveedorByRazonSocial",
            minLength: 2,
            focus: function (event, ui) {
                var select = ui.item;
                $(this).val(select.label);

                return false;
            },

            select: function (event, ui) {
                var select = ui.item;
                $(this).val(select.label);

                $('#<%= hfproveedor.ClientID %>').val(select.value);
                

                return false;
            }

        }
          );

        $("#<%= TxtMarca.ClientID %>").autocomplete({
            source: "/Service/MarcaService.asmx/GetFromMarcaByNombre",
            minLength: 2,
            focus: function (event, ui) {
                var select = ui.item;
                $(this).val(select.label);

                return false;
            },

            select: function (event, ui) {
                var select = ui.item;
                $(this).val(select.label);

                $('#<%=  hfMarca.ClientID %>').val(select.value);
              
                return false;
            }

        }
          );

    });

  
    </script>


<style type="text/css">
        .style15
        {
            width: 79px;
            font-weight: bold;
            color: #000000;
        }
        .style16
        {
            width: 199px;
        }
        .style17
        {
            width: 32px;
        }
        .style19
        {
            width: 111px;
        }
        .style22
        {
            width: 285px;
        }
        .style25
        {
            width: 99px;
        }
        .style28
        {
            width: 243px;
        }
        .style31
        {
            width: 226px;
        }
        .style32
        {
            width: 30px;
            color: #000000;
        }
        .style36
        {
            width: 190px;
        }
        .style38
        {
            width: 161px;
        }
        .style39
        {
            width: 93px;
        }
        .style40
    {
        width: 48px;
    }
        .style41
        {
            width: 75px;
            color: #000000;
        }
        .style42
        {
            width: 75px;
            color: #000000;
            font-weight: bold;
        }
        .style43
        {
            font-weight: bold;
        }
        .style44
        {
            width: 91px;
            font-weight: bold;
            color: #000000;
        }
        .style45
        {
            width: 250px;
        }
        </style>




</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
        
        <div class="post">
			<h2 class="title">  Producto  </h2>			
		</div>


         <fieldset>
    

        <asp:HiddenField ID="hfProducto" runat="server" />
        <asp:HiddenField ID="AccionHiddenField" runat="server" />


        <%--<asp:UpdatePanel ID ="Paanelpro" runat="server">
        <ContentTemplate>
--%>
        <table>

                <tr>
                    <td class="style15">
                        Categoria:</td>
                     <td class="style16">
                         <asp:DropDownList ID="comboCategoria" runat="server" 
                             DataSourceID="ObjCategoria" DataTextField="Nombre" 
                             DataValueField="IdCategoria" AutoPostBack="True" 
                             onselectedindexchanged="comboCategoria_SelectedIndexChanged">
                         </asp:DropDownList>  
                             
                         <asp:ObjectDataSource ID="ObjCategoria" runat="server" 
                             onobjectcreating="ObjCategoria_ObjectCreating" 
                             SelectMethod="GetAllFromCategoria" TypeName="Intelsi.BusinessLogic.CategoriaBL">
                         </asp:ObjectDataSource>
                             
                    </td>
                     <td class="style17">
                    </td>
                     <td class="style44">
                         Codigo:</td>
                     <td class="style19">
                         <asp:TextBox ID="TxtCodigo" runat="server" Width="90px" />
                        
                   </td>

                </tr>

                <tr>
                    <td class="style15">
                        <strong>Descripcion:</strong></td>
                     <td class="style16">
                         <asp:TextBox ID="txtDescripcionProdu" runat="server" Height="22px" Width="188px"></asp:TextBox>
                         <asp:Label ID="FaltaDescripcion" runat="server" BackColor="Red"></asp:Label>   
                              <%-- <asp:requiredfieldvalidator id="resdes" runat="server" 
                                    ControlToValidate="txtDescripcionProdu" ErrorMessage="Falta Descripcion Producto" Display="None"
                                    style="color: #FF0000">
                                 </asp:requiredfieldvalidator>


 
                               <ajaxToolkit:ValidatorCalloutExtender ID="resdes_Val" 
                              runat="server" Enabled="True" TargetControlID="resdes">
                             </ajaxToolkit:ValidatorCalloutExtender>
--%>
 
                           
                    </td>
                     <td class="style17">
                    </td>
                     <td class="style44">
                         <strong>Proveedor:</strong></td>
                     <td class="style19">
                         <asp:HiddenField ID="hfproveedor" runat ="server" />
                         <asp:TextBox ID="TxtProvedor" runat="server" Height="22px" Width="182px" ></asp:TextBox>
                    </td>

                </tr>

                <tr>
                    <td class="style15">
                        Precio 
                        
                        </td>
                     <td class="style16">
                         <asp:TextBox ID="txtPrecio" runat="server" Height="22px" Width="130px"  ></asp:TextBox>
                            
                            <%--<asp:requiredfieldvalidator id="Requiredfieldvalidator5" runat="server" 
                         ControlToValidate="txtPrecio" ErrorMessage="Falta El Precio de Compra" Display="None"
                             style="color: #FF0000"></asp:requiredfieldvalidator>

                                    <ajaxToolkit:ValidatorCalloutExtender ID="Requiredfieldvalidator5_Val" 
                                        runat="server" Enabled="True" TargetControlID="Requiredfieldvalidator5">
                                    </ajaxToolkit:ValidatorCalloutExtender>

                             <asp:regularexpressionvalidator id="Regularexpressionvalidator1" runat="server" ControlToValidate="txtPrecio" 
                             Display="None" ErrorMessage="No ingresado Incorrecto" 
                                        ValidationExpression="\d*\.?\d*" style="color: #FF0000">
                             </asp:regularexpressionvalidator>
                                
                                    <ajaxToolkit:ValidatorCalloutExtender ID="Regularexpressionvalidator1_Val" 
                                        runat="server" Enabled="True" TargetControlID="Regularexpressionvalidator1">
                                    </ajaxToolkit:ValidatorCalloutExtender>
                             --%>  
                                             
                    </td>
                     <td class="style17">
                    </td>
                     <td class="style44">
                         <table>
                             <tr>
                                 <td class="style43">
                                     Marca:</td>
                             </tr>
                         </table>
                    </td>
                     <td class="style19">
                        <asp:HiddenField  ID="hfMarca" runat ="server"/>
                         <asp:TextBox ID="TxtMarca" runat="server" Width="179px" Height="22px"  />
                         <asp:Button ID="BtnRegMarca" runat="server" Text="Nueva" 
                             onclick="BtnRegMarca_Click" />
                        
                         
                        <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" 
                        BackgroundCssClass="modalBackground" PopupControlID="Marca"
                        TargetControlID="BtnRegMarca" CancelControlID="BtnCancelar">
                    </asp:ModalPopupExtender>
                        
                         
                    </td>

                </tr>

                <tr>
                    <td class="style15">
                        <strong>Stock</strong></td>
                     <td class="style16">
                          <asp:TextBox 
                              ID="txtStock" runat="server" Height="21px" Width="58px"></asp:TextBox>
                         
<%--                               <asp:requiredfieldvalidator id="restock" runat="server" 
                                    ControlToValidate="txtStock" ErrorMessage="Falta Stock" Display="None"
                                    style="color: #FF0000">
                                 </asp:requiredfieldvalidator>

                               <ajaxToolkit:ValidatorCalloutExtender ID="restock_Val" 
                              runat="server" Enabled="True" TargetControlID="restock">
                             </ajaxToolkit:ValidatorCalloutExtender>
 
                             <asp:regularexpressionvalidator id="Restok2" runat="server" ControlToValidate="txtStock" 
                             Display="None" ErrorMessage="Ingreso Incorrecto" 
                                        ValidationExpression="\d*\.?\d*" style="color: #FF0000">
                             </asp:regularexpressionvalidator>
                                
                                    <ajaxToolkit:ValidatorCalloutExtender ID="Restok2_Val" 
                                        runat="server" Enabled="True" TargetControlID="Restok2">
                                    </ajaxToolkit:ValidatorCalloutExtender>
                             

--%>

                          &nbsp;<asp:Label ID="Stockmin" runat="server" Text="Stock Min" class="style15"></asp:Label>
                          
                         
                    &nbsp;<asp:TextBox ID="txtStockmin" runat="server" Height="22px" Width="43px"></asp:TextBox>
                          
                         <%--<asp:requiredfieldvalidator id="restocmin" runat="server" 
                                    ControlToValidate="txtStockmin" ErrorMessage="Falta Stock" Display="None"
                                    style="color: #FF0000">
                                 </asp:requiredfieldvalidator>

                               <ajaxToolkit:ValidatorCalloutExtender ID="restocmin_Val" 
                              runat="server" Enabled="True" TargetControlID="restocmin">
                             </ajaxToolkit:ValidatorCalloutExtender>
 
                             <asp:regularexpressionvalidator id="restocmin2" runat="server" ControlToValidate="txtStockmin" 
                             Display="None" ErrorMessage="Ingreso Incorrecto" 
                                        ValidationExpression="\d*\.?\d*" style="color: #FF0000">
                             </asp:regularexpressionvalidator>
                                
                                    <ajaxToolkit:ValidatorCalloutExtender ID="restocmin2_Val" 
                                        runat="server" Enabled="True" TargetControlID="restocmin2">
                                    </ajaxToolkit:ValidatorCalloutExtender>
                             --%>

                    </td>


                     <td class="style17">
                    </td>
                     <td class="style44">
                         UnidadMedida:</td>
                     <td class="style19">
                         <asp:TextBox ID="TxtUnidadMedida" runat="server" Height="22px" Width="106px"></asp:TextBox>
                    </td>

                </tr>

                
            
        </table>
        
        <table>
                <tr>
                    <td class="style22">
                        <table>
                            <tr>
                                <td class="style42">
                               <strong>
                                    <asp:Label ID="lacolor" runat="server" Text="color" ></asp:Label>
                                    <br />
                                    <asp:Label ID="labfechavenci" runat="server" Text="Fecha Vencimiento"></asp:Label>
                                    <br />
                                     <asp:Label ID="latalla" runat="server" Text="Talla"></asp:Label>
                                </strong>

                                    </td>

                                <td class="style45">
                                    <asp:TextBox ID="txtColor" runat="server"></asp:TextBox>
                                    <br />
                                    <asp:TextBox ID="TxtFechaVencimiento" runat="server" ></asp:TextBox>
                                    <br />
                                    <asp:TextBox ID="txtTalla" runat="server" ></asp:TextBox>
                                
                                </td>

                            </tr>

                            <tr>
                                <td class="style42">
                                    
                                    <asp:Label ID="laEstado" runat="server" Text="Estado" ></asp:Label>
                                    </td>

                                <td class="style45">
                                    <asp:DropDownList ID="comboEstado" runat="server" Height="18px" Width="109px">
                                    <asp:ListItem Value="Bueno" Text="Bueno" >           </asp:ListItem>
                                    <asp:ListItem Value="Normal" Text="Normal" >         </asp:ListItem>
                                    <asp:ListItem Value="Mal" Text="Malo" >              </asp:ListItem>
                                    </asp:DropDownList>
                                    </td>

                            </tr>

                            <tr>
                                <td class="style42">
                                    <asp:Label ID="laVoltaje" runat="server" Text="Voltaje"></asp:Label>
                                    </td>

                                <td class="style45">
                                    <asp:TextBox ID="txtVoltaje" runat="server" ></asp:TextBox>
                                    </td>

                            </tr>

                            <tr>
                                <td class="style41">
                                    <strong>
                                        <asp:Label ID="lamodelo" runat="server" Text="Modelo" ></asp:Label> </strong></td>

                                <td class="style45">
                                    <asp:TextBox ID="TxtModelo" runat="server" ></asp:TextBox></td>

                            </tr>
                            <%--
                            <tr>
                                <td class="style41">
                                    <strong>Email Privado:</strong></td>

                                <td class="style45">
                                    &nbsp;</td>

                            </tr>--%>
                        
                        </table>
                    </td>

                    <td class="style40">
                    </td>

                    <td class="style25">
                        <asp:Image ID="foto" runat="server" Height="133px" Width="123px" 
                            BackColor="#CCFFCC" BorderColor="Black" BorderStyle="Double" 
                            style="margin-left: 12px; margin-right: 20px" />
                    </td>
                </tr>
        </table>

         <table>
                <tr>
                    <td class="style31">
                    </td>

                     <td class="style32" >
                         <strong><asp:Label ID="lafoto" runat="server" Text="foto" ></asp:Label></strong></td>

                     <td class="style28">
                         <asp:FileUpload ID="fuFoto" runat="server" />
                    </td>
                </tr>
        
        </table>
 
    <%--    </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="comboCategoria" 
                    EventName="SelectedIndexChanged" />

                <asp:AsyncPostBackTrigger ControlID="BtnGuardar" />
            </Triggers>
        </asp:UpdatePanel>

    --%>          

        <table>
                <tr> <td class="style38">
                         &nbsp;</td> </tr>

                <tr>
                   <td class="style38"></td>

                   <td class="style39">
                       <asp:Button ID="BtnGuardar" runat="server" 
                           Text="" style="height: 26px" onclick="BtnGuardar_Click"  />
                       
                     
                       
                    </td>

                   <td class="style36">
                       <asp:Button ID="Button2" runat="server" Text="Cancelar" 
                           CausesValidation="False" />
                    </td>
                   

                </tr>


        </table>

        </fieldset>

        
        <%--Panel Para Marca--%>
        
        <asp:Panel ID="Marca" runat="server" CssClass="CajaDialogo">
            
            
         
            <fieldset>
            <legend> Registar Marca</legend>
            <asp:UpdatePanel ID="UPMarca" runat="server">
            <ContentTemplate>
                <table>
                 <asp:HiddenField ID="hfNuevaMar" runat ="server" />
                 
                    <tr>
                      
                        <td>
                        <strong> Nombre</strong>
                        </td>
                        <td>
                            <asp:TextBox ID="TxtNuevaMarca" runat="server" Height="20px" Width="180px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                    <td>
                    <strong> Comentario </strong>
                    </td>
                    <td>
                        <asp:TextBox ID="txtComentariomarca" runat="server" Height="20px" Width="178px"></asp:TextBox>
                    </td>

                    </tr>
                
                <tr>
                <td>
                    <asp:Button ID="BtnGuargarMarca" runat="server" Text="Guardar" 
                        onclick="BtnGuargarMarca_Click" />
                </td>
                <td>
                <asp:Button ID="BtnCancelar" runat="server" Text="Cancelar" />
                
                </td>
                </tr>


                </table>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="BtnGuargarMarca" EventName="Click" />
                </Triggers>
                </asp:UpdatePanel>
            </fieldset>
           
            
        </asp:Panel>
        

</asp:Content>
